<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of DateToJsonFilter
 *
 * @author Virtualidad
 */
class DateToJsonFilter implements Filter {

    function filter($value, array $params = array()) {
        
        $format = "d/m/Y";
        if (isset($params["format"])) {
            $format = $params["format"];
        }

        $timestamp = DateTime::createFromFormat($format, $value)->getTimestamp();
        $result = "/Date(" . $timestamp . "-0500)/";

        return $result;
    }

}

?>
